/*!
 *  \file       Fft2D.hpp
 *  \brief      Definizione della classe \c Fft2D
 *  \author     Davide Scola <S2299453@studenti.unige.it>
 *  \author	Minetti Alberto <S3064777@studenti.unige.it>
 *  \version    1.0
 *
 */

#ifndef _FFT2D_H
#define _FFT2D_H


/*!
 *  \brief      Definizione della classe \c Fft2D
 *
 */
template< class tType >
class Fft2D : public SimpleMatrix< std::complex< tType > > {
  public :
    typedef std::complex< tType > complex_t;
    
    typedef enum operators {
      OP_LOGARITHMIC = 01,
#define OP_LOGARITHMIC		OP_LOGARITHMIC
      OP_SQUAREROOT = 02
#define OP_SQUAREROOT		OP_SQUAREROOT
    } operator_t;
    
    Fft2D( const SimpleMatrix< tType >& );
    void compute( void );
    SimpleMatrix< tType >& outMagnitude( unsigned long int, SimpleMatrix< tType >& );
    void invert( void );
    
  protected :
    void initOperators( void );
    void computeRows( void );
    void invertRows( void );
    void computeCols( void );
    void invertCols( void );
    SimpleMatrix< tType >& marshall( unsigned long int, SimpleMatrix< tType >& );
    
  private :
    typedef void ( Fft2D::*fnOperator_t )( SimpleMatrix< tType >& );
    
    std::map< unsigned long int, fnOperator_t > operators_;
    
    void op_shift( SimpleMatrix< tType >& );
    void op_logarithmic( SimpleMatrix< tType >& );
    void op_squareRoot( SimpleMatrix< tType >& );
};

#endif              /* _FFT2D_H */
